package com.hrzyit.whistle.cases.data.repository

import android.util.Log
import com.hrzyit.base.data.net.RetrofitFactory
import com.hrzyit.base.data.protocol.BaseResp
import com.hrzyit.whistle.cases.data.api.CaseCategoryApi
import com.hrzyit.whistle.cases.data.bean.CategoryDetailsEntity
import com.hrzyit.whistle.cases.data.bean.CategoryEntity
import com.hrzyit.whistle.cases.data.bean.SysDictEntity
import com.hrzyit.whistle.cases.data.protocol.CategoryDetailsReq
import com.hrzyit.whistle.cases.data.protocol.CategoryReq
import com.hrzyit.whistle.cases.data.protocol.SysDictReq
//import rx.Observable
import io.reactivex.Observable
import javax.inject.Inject

/**
 * 案件类型数据操作类
 * @author YangWei
 * @date 2019/4/1
 */
class CaseTypeRepository @Inject constructor() {


    fun getCaseQuestionTypeList(parentId: Int, id: Int?): Observable<BaseResp<MutableList<SysDictEntity>>> {
        return RetrofitFactory.instance
            .create(CaseCategoryApi::class.java)
            .getCaseQuestionTypeList(
                SysDictReq(parentId, id)
            )

    }

    fun getCategoryList(parentId: Long, categoryType: Int): Observable<BaseResp<MutableList<CategoryEntity>>> {
        return RetrofitFactory.instance
            .create(CaseCategoryApi::class.java)
            .getCategoryList(
                CategoryReq(parentId, categoryType)
            )
    }

    fun getCaseConditionList(parentId: Long): Observable<BaseResp<MutableList<CategoryDetailsEntity>>> {
        return RetrofitFactory.instance
            .create(CaseCategoryApi::class.java)
            .getCategoryDetailsList(
                CategoryDetailsReq(parentId)
            )
    }

}